#include<bits/stdc++.h>
#define int long long
using namespace std;
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef unsigned long long ull;
 
long long read() {
    long long res=0, w=1; char c=getchar();
    while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
    while(isdigit(c)) {res=res*10+c-48, c=getchar();}
    return res*w;
}

const int N=1e6+9; 
int n,a[N],m,q,sum;
deque<int>f;

signed main() {
    freopen("pockets.in","r",stdin);
    freopen("pockets.out","w",stdout);
    n=read(); m=1000001;
    rep(i,1,n-1) a[i]=read();
    rep(i,0,m) f.push_back(i);
    rep(i,3,n-1) {
        sum+=a[i];
        vi v(a[i]);
        rep(j,0,a[i]-1) v[j]=f[j+1];
        rep(j,0,a[i]-1) f.push_front(v[j]);
        rep(j,1,a[i]) f.pop_back();
    }
    q=read();
    while(q--) {
        int x=read();
        if(x>sum) printf("%lld\n",x-sum-a[2]+a[1]);
        else printf("%lld\n",f[x]-a[2]+a[1]);
    }
    return 0;
}